package com.nuoniu.sibanyun.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nuoniu.sibanyun.entity.SysAgreement;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author baiqiang
 * @since 2020-08-31
 */
public interface SysAgreementMapper extends BaseMapper<SysAgreement> {

    @Select("SELECT * FROM (select *,row_number() over(partition by `code` order by create_date desc) as 'rank' FROM sys_agreement WHERE status = 0 ) as t WHERE t.rank = 1")
    List<SysAgreement> last();

}
